#pragma once

#include <cinttypes>
#include "Math/Vec2.h"
#include "IntPoint.m.h"


RSTRUCT()
struct WHENGINE_API SIntPoint
{

    ROBJECT

    SIntPoint()
    :X(0),Y(0)
    {}

    SIntPoint(int64_t InX,int64_t InY)
    :X(InX),Y(InY)
    {}

    SIntPoint(const SVec2& InVec2)
    :X(static_cast<int32_t>(InVec2.X)),Y(static_cast<int32_t>(InVec2.Y))
    {}

    RFIELD()
    int64_t X;
    
    RFIELD()
    int64_t Y;

    bool operator==(const SIntPoint& Other) const;

    //convert to SVec2
    SVec2 ToVec2() const;

    SIntPoint operator +(const SIntPoint& Other) const;

    SIntPoint& operator +=(const SIntPoint& Other);

    SIntPoint operator /(const SIntPoint& Other) const;

    SIntPoint operator *(const SIntPoint& Other) const;

    SIntPoint operator *(const int64_t& Other) const;

    SIntPoint operator -(const SIntPoint& Other) const;

    static SIntPoint Clamp(const SIntPoint& InValue,const SIntPoint& Min,const SIntPoint& Max );

    //return  x*x+ y*y
    int64_t LengthSquare() const;


};

namespace WH
{
    WHENGINE_API CString ToString(const SIntPoint& InValue);
}

SIntPoint Max(const SIntPoint& A,const SIntPoint& B);

SIntPoint Min(const SIntPoint& A,const SIntPoint& B);